import request from '@/utils/request'
import { TrademarkData, Trademark } from './type'

//统一管理接口
enum API {
  TRADNERK_URL = 'http://114.115.179.162:8022/prod-api/admin/product/baseTrademark/',
  SAVE_TRADEMARK_URL = 'http://114.115.179.162:8022/prod-api/admin/product/baseTrademark/save',
  UPDATE_TRADEMARK_URL = 'http://114.115.179.162:8022/prod-api/admin/product/baseTrademark/update',
  REMOVE_TRADEMARK_URL = 'http://114.115.179.162:8022/prod-api/admin/product/baseTrademark/remove/',
  GET_TRADEMARK_LIST_URL = 'http://114.115.179.162:8022/prod-api/admin/product/baseTrademark/getTrademarkList',
  GET_TRADEMARK_URL = 'http://114.115.179.162:8022/prod-api/admin/product/baseTrademark/get/',
}

//暴露请求函数
export const reqHasTradeMark = (page: number, limit: number) =>
  request.get<any, TrademarkData>(API.TRADNERK_URL + `${page}/${limit}`)
export const reqSaveTradeMark = (tradeMark: Trademark) =>
  request.post<any, TrademarkData>(API.SAVE_TRADEMARK_URL, tradeMark)

export const reqUpdateTradeMark = (tradeMark: Trademark) =>
  request.put<any, TrademarkData>(API.UPDATE_TRADEMARK_URL, tradeMark)
export const reqRemoveTradeMark = (id: number) =>
  request.delete<any, any>(API.REMOVE_TRADEMARK_URL + id)
export const reqGetTradeMarkList = () =>
  request.get<any, TrademarkData>(API.GET_TRADEMARK_LIST_URL)
export const reqGetById = (id: number) =>
  request.get<any, TrademarkData>(API.GET_TRADEMARK_URL + `${id}`)
